using Unity.VisualScripting;

namespace LS.UGFUnits
{
    public class UnloadScene: SceneUnit
    {
        [DoNotSerialize]
        [PortLabelHidden]
        public ValueInput AssetName { get; private set; }
        
        protected override void Definition()
        {
            base.Definition();
            AssetName = ValueInput<string>(nameof(AssetName), string.Empty);
            Requirement(AssetName, Input);
        }

        protected override ControlOutput In(Flow flow)
        {
            string assetName = flow.GetValue<string>(AssetName);
            Target?.UnloadScene(assetName);
            return base.In(flow);
        }
    }
}